#ifndef NALU_INCLUDE_H
#define NALU_INCLUDE_H

#include <cstdint>
#include <vector>

typedef enum {
    // 基于ffmpegeg获取nalu时候序号(H265)
    NALU_TYPE_TRAIL_N    = 0,
    NALU_TYPE_TRAIL_R    = 1,
    NALU_TYPE_TSA_N      = 2,
    NALU_TYPE_TSA_R      = 3,
    NALU_TYPE_STSA_N     = 4,
    NALU_TYPE_STSA_R     = 5,
    NALU_TYPE_RADL_N     = 6,
    NALU_TYPE_RADL_R     = 7,
    NALU_TYPE_RASL_N     = 8,
    NALU_TYPE_RASL_R     = 9,
    // 组成H265包的核心nalu类型
    NALU_TYPE_VPS        = 32,
    NALU_TYPE_SPS        = 33,
    NALU_TYPE_PPS        = 34,
    NALU_TYPE_AUD        = 35,
    NALU_TYPE_EOS_NUT    = 36,
    NALU_TYPE_EOB_NUT    = 37,
    NALU_TYPE_FD_NUT     = 38,
    NALU_TYPE_SEI_PREFIX = 39,
    NALU_TYPE_SEI_SUFFIX = 40,
    NALU_TYPE_IDR_W_RADL = 19,
    NALU_TYPE_IDR_N_LP   = 20,
    NALU_TYPE_CRA_NUT    = 21,
    // 分片类型
    NALU_TYPE_FRAGMENT_UNIT = 49,
    FD = 44,
} NaluType;

class Nalu {
public:
    std::vector<uint8_t> packet;
    int length;
    NaluType type;

    Nalu() : length(0), type(NaluType::FD) {}

    Nalu(const uint8_t* data, size_t size, NaluType naluType)
            : packet(data, data + size), length(size), type(naluType) 
            {}
    
};

#endif
